package com.android.goal;

import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;

public class Match {
	private String homeScore,awayScore,homeName,awayName;
	private int IDMatch;
	private String kickOff;
	
	public Match(){
		homeScore = null;
		awayScore = null;
		homeName = null;
		awayName = null;
		IDMatch = 0;
		kickOff = null;		
	}
	
	public Match(JSONObject json){
		this.parseInfo(json);
	}

	public void parseInfo(JSONObject object){
		try {									
			this.awayName = object.getString("awayName");
			this.homeName = object.getString("homeName");
			this.homeScore = object.getString("homeScore");
			this.awayScore = object.getString("awayScore");
			this.IDMatch = object.getInt("IDMatch");
			this.kickOff = object.getString("kickOff"); 
		} catch (JSONException e) {
			e.printStackTrace();
		}		
	}
	
	public String getHomeName(){
		return this.homeName;
	}
	
	public String getAwayName(){
		return this.awayName;
	}
	
	public String getScore(){
		return this.homeScore + " - " + this.awayScore;
	}
	
	public String toString(){
		return homeName + " " + homeScore + "-" + awayScore + " " + awayName;
	}	
}
